<?php echo $header; ?>

<!-- Content -->
	<div id="main" class="p13t">
		<!-- Left column -->
		<?php echo $column_left; //$column_left_product; ?>
		
		<div id="col2" class="w709">
			<div class="box_tt">
				<?php if(1==0){ ?>                    
                <h4 class="float_left p5t"><?php echo $heading_title; ?></h4>                      
                <?php } ?>        
                <h4 class="float_left p5t">                     
                    <?php foreach ($breadcrumbs as $breadcrumb) { ?> 
                        <?php if($breadcrumb['href']) { ?>                      
                            <span class="breadcrumb_sep"><?php echo $breadcrumb['separator']; ?></span>
                            <a href="<?php echo $breadcrumb['href']; ?>"> <span class="breadcrumb_text"><?php echo $breadcrumb['text']; ?></span></a>
                        <?php }else { ?> 
                            <span class="breadcrumb_sep"><?php echo $breadcrumb['separator']; ?></span><span class="breadcrumb_text"><?php echo $breadcrumb['text']; ?></span>                    
                        <?php } ?> 
                    <?php } ?>
                </h4>
                <!--
				<span class="float_right"><a href="<?php echo $back_product; ?>"><img src="catalog/view/theme/<?php echo $template; ?>/images/bt_tibagetilprodukter.png"/></a></span>		
                -->
			</div>
			<div class="box_content_underpage">
				<div class="box_content_underpage1 min_heght">                      
				  	<div class="p26t p26l p20r">
                        <!-- Sort and page view -->
                        <?php //if($products){ ?>
                            <div class="tt_top_pro1"> 
                                <?php if(1==0){ ?>
                                    <span class="float_left"><a class="sort_products" href="<?php echo $price_sort['desc']['href']; ?>"><img <?php echo $price_sort['desc']['current'] ? ' class="active"' : '';?> src="catalog/view/theme/<?php echo $template; ?>/images/bt_prishojlow.jpg" /></a></span> 
                                    <span class="float_left"><a class="sort_products" href="<?php echo $price_sort['asc']['href']; ?>"><img <?php echo $price_sort['asc']['current'] ? ' class="active"' : '';?> src="catalog/view/theme/<?php echo $template; ?>/images/bt_prislowhoj.jpg" /></a></span>       
                                <?php } ?>
                                
                                <div class="float_left" style="padding: 7px 0 0 7px;">
									<?php if($products){ ?>
										<span class="sort_products"><?php echo $text_sort; ?></span>
										<select class="sort_products" name="sort" onchange="location = this.value">
											  <?php foreach ($sorts as $sort_item) { ?>
												  <?php if (($sort . '-' . $order) == $sort_item['value']) { ?>
													  <option value="<?php echo $sort_item['href']; ?>" selected="selected"><?php echo $sort_item['text']; ?></option>
												  <?php } else { ?>
													  <option value="<?php echo $sort_item['href']; ?>"><?php echo $sort_item['text']; ?></option>
												  <?php } ?>
											  <?php } ?>
										</select>
										&nbsp;&nbsp;&nbsp;&nbsp;
									<?php } ?>	
									<?php $attr = current($attributes); ?>
									<?php if($attr['attribute_values']){ //if($attributes){ ?>
										<span class="sort_products">Sorter efter størrelse</span>
										<select class="sort_products" name="product_size" onchange="location = this.value" style="width:150px;">
											<?php foreach ($attributes as $attribute) { ?>
												<option value="<?php echo $filter_size . '0'; ?>">- Alle -</option>
												<!-- optgroup lablel="--" -->
													<?php foreach ($attribute['attribute_values'] as $attribute_value) { ?>
														<?php if ($attribute_value['value_id'] == $current_size) { ?>
															<option value="<?php echo $filter_size . $attribute_value['value_id']; ?>" selected="selected"><?php echo $attribute_value['name']; ?></option>
														<?php } else { ?>
															<option value="<?php echo $filter_size . $attribute_value['value_id']; ?>"><?php echo $attribute_value['name']; ?></option>
														<?php } ?>
													<?php } ?>
												<!-- /optgroup -->
											<?php } ?>
										</select>
									<?php } ?>
                                </div>  								
								<div class="page_top">   
									<?php if($products){ ?>
										<ul>
											<li style="padding:0 10px">Vis emner</li>                                   
											<?php $size = count($limits); ?>
											<?php for($i = 0; $i < $size; $i++){ ?> 
												<?php 
												$item = $limits[$i];
												$css = $item['current'] ? 'class="current"' : '';
												if($i == $size - 1){
													$css .= ' style="border-right:none"'; 
												}
												?>               
												<li <?php echo $css; ?>><a href="<?php echo $item['href']; ?>"><?php echo $item['value']; ?></a></li>                                                                                
											<?php } ?>                               
										</ul>
									<?php } ?>
								</div>								
                                <div class="cb"></div>  
                            </div>
                        <?php //} ?>                         
                        <div class="m15t"><?php echo $description ?></div>
                        <!-- Product details -->
                        <div class="products_list">                            
                            <?php if($products){ ?>          
                                <?php $size = sizeof($products); ?>
                                <?php for ($i = 0; $i < $size; $i += 3){ //for ($i = 0; $i < $size; $i += 4) { ?> 
                                    <?php $count = 1 ; ?> 
                                    <?php for ($j = $i; $j < ($i + 3); $j++) { //for ($j = $i; $j < ($i + 4); $j++) { ?>
                                        <?php 
                                        if($size == $j){
                                            break;
                                        }
                                        
                                        //if($count % 4 == 0){ 
                                        if($count % 3 == 0){ 
                                           //$css_class = ' p26l p26t';
                                           $css_class = ' pr_pad_left p20t';
                                        }
                                        else{ 
                                            //$css_class = ' line_pro_right p28r' . (($count % 4 == 1) ? ' p26t' : ' p26l p26t'); 
                                            $css_class = ' line_pro_right pr_pad_right_cat' . (($count % 3 == 1) ? ' p20t' : ' pr_pad_left p20t'); 
                                        }
                                        $count++;
                                        
                                        $item = $products[$j];
                                        ?> 
                                        
                                        <div class="box_img_pro float_left<?php echo $css_class; ?> hover">
											<div class="product_img_container">
												<a href="<?php echo $item['href']; ?>" title="<?php echo $item['name']; ?>">
													<img src="<?php echo $item['thumb']; ?>" alt="<?php echo $item['name']; ?>" />
												</a>
												<?php if($item['options']) { ?>
													<a class="product_sizes_popup" href="<?php echo $item['href']; ?>">
														<?php $op = 0; ?>
														<?php foreach($item['options'] as $options){ ?>
															<?php                                            
															$option_data = '';                                            
															foreach($options['option_value'] as $option_item){
																$option_data .=  $option_item['name'] . ', ';
															}
															$option_data = trim($option_data, ', ');
															?>
																
															<p class="header <?php echo ($op > 0 ? ' p5t' : ''); ?>"><?php echo (strcasecmp($options['name'], 'Størrelse') == 0) ? 'Størrelser' : $options['name'] ?></p>
															<p class="data"><?php echo $option_data ?></p>
															<?php $op++; ?>
														<?php } ?>
													</a>
												<?php } ?>
											</div>
                                            <div class="text_pro cat_product_name">
                                                <?php if(1==0){ ?>
                                            	    <div class="box_color" style="display:none;">
                                            		    <?php if($item['colors']){ ?>
														    <?php $count_color = count($item['colors']) - 1; ?>
														    <?php $table = ($count_color >= 6) ? 121 : ($count_color + 1) * 20; ?>
													  	    <table width="<?php echo $table; ?>" border="0" cellspacing="0" cellpadding="0">
													  		    <tr>
													  			    <?php $k = 0; ?>																
													  			    <?php foreach($item['colors'] as $color){ ?>
																	    <?php $style = ($k == $count_color) ? 'style="text-align:right"' : ''; ?>
																	    <?php 
																		    if($k == 0){
																			    $width = 20;
																		    }
																	 	    elseif($k == $count_color){
																			    $width = 17;
																		    }
																		    else{
																			    $width = 20; //21;
																		    }
																	    ?>
															    	    <td <?php echo $style; ?> width="<?php echo $width; ?>">
															    		    <img src="<?php echo $color['thumb']; ?>" />
																	    </td>
																	    <?php $k++; ?>
																    <?php } ?>																
													  		    </tr>
														    </table>
													    <?php }else{ ?>
														    <table width="20" border="0" cellspacing="0" cellpadding="0">
													  		    <tr>
													  			    <td style="height:8px;"></td>															
													  		    </tr>
														    </table>
													    <?php } ?>															
												    </div> 
                                                    
                                                    <?php echo $item['shortname']; ?><br>
                                                    <span class="style1">ID: <?php echo $item['sku']; ?></span><br>
                                                    <span class="style2"><?php echo $item['ref_price'] ? 'Priser fra ' . $item['ref_price'] : $item['price']; ?></span><br>
                                                <?php } ?>
                                                
                                                <?php echo $item['shortname']; ?>
                                                <?php //if($item['unbreak']){ echo '<br />';} ?>
                                                <br>    
                                                <?php if(!empty($item['discounts']) || $item['discount']){ ?>
                                                    <span class="cat_style9"><span class="cat_style9_discount"><?php echo $item['ref_price'] ? 'Priser fra ' . $item['ref_price'] : $item['discount']; ?></span></span>&nbsp;&nbsp;
                                                    <span class="cat_style3"><span class="cat_style2_discount">&nbsp;<?php echo $item['price']; ?></span></span>
                                                <?php }else{ ?>
                                                    <span class="cat_style2"><?php echo $item['ref_price'] ? 'Priser fra ' . $item['ref_price'] : $item['price']; ?></span><br>
                                                <?php } ?>
												<p class="float_left1"><a href="<?php echo $item['href']; ?>" class="bg_buynow">Bestil nu</a></p>
												<div class="float_right1">
													<span class="tooltips_shipping_list">Se pris inkl. fragt/gebyr</span>
													<div class="tooltips_shipping_style_list"><?php echo $shipping_note; ?></div>
												</div>												
                                            </div>
                                        </div>                                       
                                    <?php } ?>                                      
                                    <div class="cb"></div> 
                                <?php } ?>                                                                     
                            <?php }else { ?>    
                                <div style="15px; text-align: center;">
                                    <h3 style="color: #000; font-size: 14px; text-transform: none;"><b><?php echo $text_error; ?></b></h3>                
                                </div>                             
                                <div class="cb"></div>
                            <?php } ?>
							<!-- div class="tooltips_shipping_style_list"><?php echo $shipping_note; ?></div -->
                        </div>
                        
                        <!-- Paging -->
                        <?php if($pagination){ ?>
                            <div class="tt_top_pro1 m26t">
                                   <?php echo $pagination; ?>
                            </div>
                        <?php } ?>
                    </div>
				</div>
			</div>
			
            <div class="box_bottom">
                <div class="all_page_bt"></div>
            </div>
        </div>
        
		<p class="cb"></p>
	</div>	
</div>
<!-- End content -->

<!-- footer -->
<?php echo $footer; ?> 

<script type="text/javascript"><!--
    /*
	jQuery(document).ready(function(){ 
		var color = jQuery('.hover').css('background-color');
		     	
		jQuery('.hover').hover(
			function(){								
				jQuery(this).css('background-color', '#C0C0C0');
			},
			function(){ 
				jQuery(this).css('background-color', color);					
			}
		); 
	});
    */
//-->
</script>

<script type="text/javascript">
	//Begin show text when mouseover
	jQuery(document).ready(function() {		
		jQuery(".tooltips_shipping_list").hover(
			function(){ jQuery(this).siblings('div.tooltips_shipping_style_list:first').css({ display: "block" }); },
			function() { jQuery(this).siblings('div.tooltips_shipping_style_list:first').css({ display: "none" }); }
			//function(){jQuery('.tooltips_shipping_style_list').css({ display: "block"});},
			//function(){jQuery('.tooltips_shipping_style_list').css({ display: "none" });}
		);
		
		jQuery(".product_img_container").mouseover(
            function(event){
				var element =  jQuery(this).children('.product_sizes_popup');
				if(element.length > 0){
					element.css({display: "block"});
				}
            }).mouseout(function(event){
				var element =  jQuery(this).children('.product_sizes_popup');
                if(element.length > 0){
					element.css({display: "none"});
				}
            }
        );
	});
	
	/*
	jQuery(".tooltips_shipping_list").mousemove(function(e) {
		var position = jQuery(this).position();				
		var top_p = position.top;
		var left_p = position.left;
		
		jQuery('.tooltips_shipping_style_list').css({top: top_p, left: left_p});
	});
	*/
</script>
